define(function(require,exports,module){
  var $ = require("jquery");
function deletePhone(o){

  document.getElementById("addPhone").removeChild(document.getElementById("divP_"+o));
}
function deleteEmail(o){

  document.getElementById("addEmail").removeChild(document.getElementById("divE_"+o));
}
function deleteIM(o){

  document.getElementById("addIM").removeChild(document.getElementById("divI_"+o));
}
function deleteData(o){
  $("tr[id=divD_"+o+"]").remove();
}

    var i = 100;
    function addPhones(){
      this.i++;
      $("#addPhone").append('<div id="divP_'+this.i+'" >'+$("#selectdiv").html()+'&nbsp;<input name="phone" type="text" value="" class="form-control" id="phone'+this.i+'" />&nbsp;<input type="button" class="remove" value="删除" /></div>').find("input.remove").click(function() {
        $(this).parent().remove();
      });
    }
    function addEmails(){
      this.i++;
      $("#addEmail").append('<div id="divE_'+this.i+'" >'+$("#emaildiv").html()+'&nbsp;<input name="eMail" type="text" value="" class="form-control" id="eMail'+this.i+'"/>&nbsp;<input type="button" class="remove"  value="删除" /></div>').find("input.remove").click(function() {
        $(this).parent().remove();
      });
    }
    function addIMs(){
      this.i++;
      $("#addIM").append('<div id="divI_'+this.i+'" >'+$("#imdiv").html()+'&nbsp;<input name="IM" type="text" value="" class="form-control" id="IM'+this.i+'" />&nbsp;<input type="button" class="remove" value="删除" /></div>').find("input.remove").click(function() {
        $(this).parent().remove();
      });
    }
    function addDatas(){
      this.i++; 
      $("#addData").append('<tr><td><input name="description" value="" type="text" size="20" /></td><td><input name="fieldName" value="" type="text" size="20" /></td><td><input name="column" type="text" value="" size="20" /></td><td><div  style="float: left">'+$("#dataTypediv").html()+'</div></td><td><input type="button" class="remove" value="删除" /></td></tr>').find("input.remove").click(function() {
        $(this).parent().parent().remove();                                                                                                                                                                                                    
      });
    }
    function addFields(){
      this.i++; 
      $("#addData").append('<tr><td><input name="fieldName" value="" type="text" size="20" /></td><td><input name="fieldMark" type="text" value="" size="20" /></td><td><input type="button" class="remove" value="删除" /></td></tr>').find("input.remove").click(function() {
        $(this).parent().parent().remove();                                                                                                                                                                                                    
      });
    }

  exports.addIMs = addIMs;
  exports.addPhones = addPhones;
  exports.addEmails = addEmails;
  exports.addDatas = addDatas;
  exports.addFields = addFields;
  exports.deletePhone = deletePhone;
  exports.deleteEmail = deleteEmail;
  exports.deleteIM = deleteIM;
  exports.deleteData = deleteData;
});
